package mutsumimod.cards.custom;

import com.megacrit.cardcrawl.actions.common.HealAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.dungeons.AbstractDungeon;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mutsumimod.cards.BaseCard;
import mutsumimod.character.Mutsumi;
import mutsumimod.monitors.ForgetMonitor;
import mutsumimod.powers.ForgetPower;
import mutsumimod.util.CardStats;

public class Forget extends BaseCard {
    public static final String ID = makeID(Forget.class.getSimpleName());
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.UNCOMMON,
            CardTarget.SELF,
            1
    );


    public Forget() {
        super(ID, info);
        setAttr(0,0,2);
        setAttrUpg(0,0,1);
        selfRetain=true;
        exhaust=true;
        setCustomVar("TL",ForgetMonitor.damageTakenLastTurn);
        updateDescription();
    }

//    @Override
//    public Forget makeStatEquivalentCopy(){
//        Forget card=(Forget) super.makeStatEquivalentCopy();
//        card.setCustomVar("TL",ForgetMonitor.damageTakenLastTurn);
//        return card;
//    }

    @Override
    public void atTurnStart() {
        setCustomVar("TL",ForgetMonitor.damageTakenLastTurn);
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        if(ForgetMonitor.damageTakenLastTurn>0){
            addToBot(new HealAction(p,p,ForgetMonitor.damageTakenLastTurn));
            applyPowerSelf(new ForgetPower(p,magicNumber,ForgetMonitor.damageTakenLastTurn));
        }
    }

    @Override
    public void updateDescription() {
        if(AbstractDungeon.player==null){
            rawDescription=cardStrings.DESCRIPTION;
        }else{
            rawDescription=cardStrings.DESCRIPTION+cardStrings.EXTENDED_DESCRIPTION[0];
        }
        initializeDescription();
    }

    @Override
    public AbstractCard makeCopy() {
        return new Forget();
    }


}
